﻿using System;
using CcrFlows.Core;
using Microsoft.Ccr.Core;

namespace SampleFlow
{
    class Program_StatefulStages
    {
        static void Main()
        {
            var flow = Flow<string>
                .Do<string>(SplitTextIntoWords)
                .Do(new AssembleLineFromWords(10));

            flow.Input.Post("the quick brown fox jumps over the lazy dog");

            flow.Receive(Console.WriteLine);

            Console.ReadLine();
        }


        static void SplitTextIntoWords(string text, Port<string> words)
        {
            foreach (string word in text.Split(' '))
                words.Post(word);
            words.Post(null);
        }
    }
}
